package cn.gok;

import java.io.*;

public class 字符流 {
    public static void main(String[] args) throws IOException {
        Writer wr = new FileWriter("E:\\resp1\\day4\\src\\cn\\gok\\c.txt", true);//是否追加，true代表追加，false
        wr.write(98);
        wr.write("bc");
        char c[] = {'d', 'e', 'f'};
        wr.write(c);
        wr.close();

        Reader rd = new FileReader("E:\\resp1\\day4\\src\\cn\\gok\\d.txt");
        rd.read();
        char c2[]=new char[5];
        int len=0;
        while((len=rd.read(c2))!=-1){
            System.out.println(new String(c2,0,len));
        }
        rd.close();

        //文本文件的复制
        Reader rd1=new FileReader("E:\\resp1\\day4\\src\\cn\\gok\\a.txt");

        Writer wr1 = new FileWriter("E:\\resp1\\day4\\src\\cn\\gok\\b.txt");
        char c3[]=new char[2];
        len=0;
        while((len= rd1.read(c3))!=-1){
            wr1.write(c2,0,len);
        }
    }
}
